import { RouteRecordRaw } from 'vue-router';
import { Layout, TeacherLayout } from '@/router/constant';
import { SettingOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils/index';
import { UnorderedListOutlined } from '@vicons/antd';
const routeName = 'teacher';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/teacher',
    name: routeName,
    component: Layout,
    redirect: '/teacher/course',
    meta: {
      title: '教师课程',
      icon: renderIcon(SettingOutlined),
      sort: 5,
      permissions: ['teacher'],
      hidden:true
    },
    children: [
      {
        path: 'course',
        name: 'teacher_course',
        meta: {
          title: '课程列表',
        },
        component: () => import('@/views/teacher/courseList.vue'),
      },{
        path: 'course_student_list/:courseID',
        name: 'teacher_course_student_list',
        meta: {
          title: '课程学生列表',
        },
        component: () => import('@/views/teacher/courseStudentList.vue'),
      },
      {
        path: 'course_detail/:courseID',
        name: 'teacher_course_detail',
        redirect: to => { return '/teacher/course_detail/' + to.params.courseID + '/chapter' },
        meta: {
          title: '课程详情',
          hidden: true,
          keepAlive: true,
        },
        component: TeacherLayout,
        children: [
          {
            path: 'chapter',
            name: 'teacher_chapter',
            meta: {
              title: '章节列表',
            },
            component: () => import('@/views/teacher/chapter/chapter.vue'),
          },
          {
            path: 'discuss',
            name: 'teacher_discuss',
            meta: {
              title: '讨论列表',
            },
            component: () => import('@/views/teacher/discuss/discuss.vue'),
          },{
            path: 'discussDetail/:discussID',
            name: 'teacher_discuss_detail',
            meta: {
              title: '讨论室',
            },
            component: () => import('@/views/teacher/discuss/discussDetail.vue'),
          },
          {
            path: 'exam',
            name: 'teacher_exam',
            meta: {
              title: '测验列表',
            },
            component: () => import('@/views/teacher/exam/exam.vue'),
          }, {
            path: 'addExam',
            name: 'teacher_addExam',
            meta: {
              title: '添加测验',
            },
            component: () => import('@/views/teacher/exam/addExam.vue'),
          }, {
            path: 'editExam/:EID',
            name: 'teacher_editExam',
            meta: {
              title: '编辑测验',
            },
            component: () => import('@/views/teacher/exam/editExam.vue'),
          }, {
            path: 'countExam/:EID',
            name: 'teacher_countExam',
            meta: {
              title: '测验统计',
            },
            component: () => import('@/views/teacher/exam/countExam.vue'),
          }, {
            path: 'question',
            name: 'teacher_question',
            meta: {
              title: '题库',
            },
            component: () => import('@/views/teacher/question/question.vue')
          }
        ]
      },
    ],
  },
  {
    path: '/teacherTele',
    name: 'teacherTele',
    component: Layout,
    redirect: '/teacher/course',
    meta: {
      title: '课程列表',
      icon: renderIcon(UnorderedListOutlined),
      sort: 5,
      permissions: ['teacher'],
    },
  }
];

export default routes;
